package com.wootion.cims.exception;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 业务异常信息统一封装
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@ApiModel(value = "自定义全局异常类")
public class BusinessException extends Exception implements Serializable {
    private static final long serialVersionUID = 1L;

    public BusinessException(Long code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
    public BusinessException(String message) {
        super(message);
        this.message = message;
    }
    /**
     * 错误编码
     */
    @ApiModelProperty(value = "异常状态码")
    private Long code;
    /**
     * 错误信息
     */
    @ApiModelProperty(value = "异常信息")
    private String message;
}
